package com.yunxi.order.feign.fallback;

import com.yunxi.order.feign.ProductFeignClient;
import com.yunxi.product.bean.Product;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * 远程调用商品服务的失败回调
 *
 * @author: lidy
 * @date: 2025-01-18 13:03
 */
@Component
public class ProductFeignClientFallback implements ProductFeignClient {

    @Override
    public Product getProductById(Long productId) {
        System.out.println("兜底回调......");
        Product product = new Product();
        product.setId(productId);
        product.setPrice(new BigDecimal("0"));
        product.setProductName("未知商品");
        product.setNum(0);

        return product;
    }

}
